package com.wgworkshop.pems.entity;

import com.wgworkshop.pems.common.enums.ClassArrangeStatusEnum;
import com.wgworkshop.pems.entity.converter.ClassArrangeStatusConverter;
import com.wgworkshop.pems.model.ClassArrangeByClassRecord;

import javax.persistence.*;
import java.util.Date;

/**
 * 班级安排实体类。
 * Created by wlc on 2017/10/11.
 */
@Entity(name = "class_arrange")
@SqlResultSetMapping(
        name = "ClassArrangeByClassRecordMapping",
        classes = {
                @ConstructorResult(
                        targetClass = ClassArrangeByClassRecord.class,
                        columns = {
                                @ColumnResult(name = "week", type = Integer.class),
                                @ColumnResult(name = "class_num", type = Integer.class),
                                @ColumnResult(name = "student_count", type = Long.class)
                        }
                )
        }
)
public class ClassArrangeEntity extends AbstractBaseEntity {
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn
    private StudentEntity student;
    @Temporal(TemporalType.DATE)
    private Date startDate;
    private Integer classNum;
    @Convert(converter = ClassArrangeStatusConverter.class)
    private ClassArrangeStatusEnum status;

    public StudentEntity getStudent() {
        return student;
    }

    public void setStudent(StudentEntity student) {
        this.student = student;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Integer getClassNum() {
        return classNum;
    }

    public void setClassNum(Integer classNum) {
        this.classNum = classNum;
    }

    public ClassArrangeStatusEnum getStatus() {
        return status;
    }

    public void setStatus(ClassArrangeStatusEnum status) {
        this.status = status;
    }
}
